#!/bin/bash

FILE=fish-3.0.0.tar.gz
FILE_DIR=fish-3.0.0
yum install wget gcc glibc-headers gcc-c++ ncurses-devel -y

if [ ! -f $FILE ]; then
wget https://github.com/fish-shell/fish-shell/releases/download/3.0.0/fish-3.0.0.tar.gz
fi

if [ ! -d $FILE_DIR ]; then
tar xvf $FILE
fi

cd $FILE_DIR

./configure
make
make install

if [ `grep -c "/usr/local/bin/fish" /etc/shells` -eq '0' ]; then
   echo "Add fish to /etc/shells"
   echo "/usr/local/bin/fish" >> /etc/shells
else
   echo "Fish has been in shells !"
fi

chsh -s /usr/local/bin/fish

echo "Finished"





